package com.zlcx.tz.live.domain.backup;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zlcx.tz.live.domain.LiveRoomInfo;
import com.zlcx.tz.live.utils.DozerMapper;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;

/**
 * <p>房间信息</p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 * @author zl
 * @date Created in 2019/4/18 10:10
 * @version 1.0
 * @copyright: Copyright (c) founders
 */

@Data
@Entity(name = "live_room_info_backup")
@JsonSerialize
@DynamicUpdate
@DynamicInsert
public class LiveRoomInfoBackUpDO {

    @Id
    private Long id;
    /**
     * 房间名称
     */
    private String roomName;
    /**
     * 房间描述
     */
    private String roomDesc;
    /**
     * 房间连麦最大人数
     */
    private Integer roomPublisherMax;
    /**
     * 房间最大人数
     */
    private Integer roomJoinerMax;
    /**
     * 房间状态
     *
     * @see com.zlcx.tz.live.enums.RoomState
     */
    private Integer roomState;
    /**
     * 房间禁麦状态 0-禁麦，1-不禁麦
     */
    private Integer roomMicState;
    /**
     * 房间背景图
     */
    private String roomAvatar;

    private Date createTime;

    private Date updateTime;

    public static LiveRoomInfoBackUpDO from(LiveRoomInfo liveRoomInfo){
        LiveRoomInfoBackUpDO liveRoomInfoBackup = new LiveRoomInfoBackUpDO();
        DozerMapper.getInstance().map(liveRoomInfo, liveRoomInfoBackup);
        return liveRoomInfoBackup;
    }

}